//
//  CLLoginViewController.swift
//  CLEasyBBQ
//
//  Created by simon zhao on 2017/4/30.
//  Copyright © 2017年 simon zhao. All rights reserved.
//

import UIKit

class CLLoginViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.view.backgroundColor = UIColor.rgbColorFromHex(rgb: 0xF0F0F0)
        
        let showImgView = UIImageView.init(image: UIImage.init(named: "logoIcon"))
        self.view.addSubview(showImgView)
        showImgView.snp.makeConstraints { (make) in
            
            make.top.equalTo(self.view).offset(screenHeight * 0.16)
            make.centerX.equalTo(self.view)
            make.width.equalTo(screenWidth * 0.3)
            make.height.equalTo(screenWidth * 0.3)
        }
        
        
        
        let accountTxf = CLTextFiled()
        accountTxf.backgroundColor = UIColor.white
//        accountTxf.layer.borderColor = UIColor.lightGray.cgColor
//        accountTxf.layer.borderWidth = 1
        accountTxf.layer.cornerRadius = 5
        accountTxf.leftView  = UIImageView.init(image: UIImage.init(named: "accountImg"))
        accountTxf.leftViewMode = UITextFieldViewMode.always
        accountTxf.placeholder = "手机号"
        self.view.addSubview(accountTxf)
        accountTxf.snp.makeConstraints { (make) in
            
            make.left.equalTo(self.view).offset(screenWidth * 0.05)
            make.right.equalTo(self.view).offset(-(screenWidth * 0.05))
            make.top.equalTo(showImgView.snp.bottom).offset(screenHeight * 0.08)
            make.height.equalTo(screenWidth * 0.12)
    
        }
        
        
        let pwdTxf = CLTextFiled()
//        pwdTxf.layer.borderColor = UIColor.lightGray.cgColor
//        pwdTxf.layer.borderWidth = 1
        pwdTxf.backgroundColor = UIColor.white
        pwdTxf.layer.cornerRadius = 5
        pwdTxf.leftView = UIImageView.init(image: UIImage.init(named: "pwdImg"))
        pwdTxf.leftViewMode = UITextFieldViewMode.always
        pwdTxf.placeholder = "密码"
        self.view.addSubview(pwdTxf)
        pwdTxf.snp.makeConstraints { (make) in
            
            make.left.equalTo(accountTxf)
            make.right.equalTo(accountTxf)
            make.top.equalTo(accountTxf.snp.bottom).offset(screenWidth * 0.05)
            make.height.equalTo(accountTxf)
        }
        
        
        let loginBtn = UIButton.init(type: .custom)
        loginBtn.setTitle("登录", for: .normal)
        loginBtn.backgroundColor = globalColor
        loginBtn.layer.cornerRadius = 5
        self.view.addSubview(loginBtn)
        loginBtn.snp.makeConstraints { (make) in
            
            make.left.equalTo(pwdTxf)
            make.right.equalTo(pwdTxf)
            make.top.equalTo(pwdTxf.snp.bottom).offset(screenWidth * 0.05)
            make.height.equalTo(pwdTxf)
        }
        
        let forgrtPwdBtn = UIButton.init(type: .custom)
        forgrtPwdBtn.setTitle("忘记密码", for: .normal)
        forgrtPwdBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        forgrtPwdBtn.setTitleColor(UIColor.gray, for: .normal)
        self.view.addSubview(forgrtPwdBtn)
        forgrtPwdBtn.snp.makeConstraints { (make) in
            
            make.left.equalTo(loginBtn).offset(5)
            make.top.equalTo(loginBtn.snp.bottom).offset(screenWidth * 0.05)
            make.width.equalTo(70)
            make.height.equalTo(20)
        }
        
        let registBtn = UIButton.init(type: .custom)
        registBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        registBtn.setTitle("快速注册", for: .normal)
        registBtn.setTitleColor(UIColor.gray, for: .normal)
        self.view.addSubview(registBtn)
        registBtn.snp.makeConstraints { (make) in
            
            make.top.equalTo(forgrtPwdBtn)
            make.right.equalTo(loginBtn)
            make.width.equalTo(70)
            make.height.equalTo(forgrtPwdBtn)
            
        }
        

        
        // Do any additional setup after loading the view.
    }
    
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
